import java.util.*;


public class DecimalToHexConversion {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        
        System.out.println("Jāievada decimāls : ");
        int dec = scanner.nextInt();
        
        System.out.println("HEXa vērtība ir " + decToHex(dec));
    }
    
    public static String decToHex(int dec) {
        char hex = '0';
        
        while(dec != 0) {
            int hexValue = dec % 16;
            hex = (toHexChar(hexValue) + hex);
            dec /= 16;
        }
        
        return hex;
    }
    
    public class char toHexChar(int hexValue) {
        if(hexValue <= 9 && hexValue >= 0)
            return (char)(hexValue + '0');
        else
            return (char)(hexValue - 10 + 'A');
    }
}